package com.carleasoft.mps.core.perm;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @program:
 * @description:缓存用户权限信息，在请求线程中加入，避免数据库查询
 * @author: ztm
 * @create: 2019/11/21 10:05
 **/
@Data
public class DataPermCache implements Serializable  {

    private static final long serialVersionUID = 1L;

    /**
     * @program:
     * @description:1-全部;2-指定组织分类;3-指定组织;4-所在组织;5-指定部门;6-所在部门
     *
     * 当dataType=1时，查询所有数据，不加入任何查询条件
     *
     * 当dataType=2时，dataCode返回organizationCodeTypeCode
     *  select * from (" + originalSql + ") temp_data_scope where temp_data_scope.organizationCodeTypeCode" in (" + dataCode + ")"
     *
     * 当dataType=3,4时，dataCode返回organizationCode，因为顶级部门deptCode=organizationCode，其中也等同于返回deptCode=organizationCode
     * select * from (" + originalSql + ") temp_data_scope where temp_data_scope.organizationCode" in (" + dataCode + ")"
     *
     * 当dataType=5,6时，dataCode只返回deptCode
     *select * from (" + originalSql + ") temp_data_scope where temp_data_scope.deptCode" in (" + dataCode + ")"
     *
     * @author: ztm
     * @create: 2019/11/21 10:05
     **/

    private Integer dataType;
    private List<String> deptCodes;
    private List<String> organizationCodes;
    private List<String> organizationCodeTypeCodes;

}
